package com.yunji.base.service;

import com.yunji.base.convert.SiteLocationTypeConvert;
import com.yunji.base.dao.ISiteLocationTypeDao;
import com.yunji.base.domain.SiteLocationTypeDO;
import com.yunji.base.params.SiteLocationTypeParam;
import com.yunji.base.vo.SiteLocationTypeVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SiteLocationTypeService {

    @Resource
    private ISiteLocationTypeDao locationTypeDao;

    public Long create(SiteLocationTypeDO domain) {
        locationTypeDao.save(domain);
        return domain.getLocationTypeId();
    }

    public void update(SiteLocationTypeDO domain) {
        locationTypeDao.updateById(domain);
    }

    public void delete(List<Long> list) {
        locationTypeDao.removeByIds(list);
    }

    public SiteLocationTypeVO getInfo(Long id) {
        return SiteLocationTypeConvert.DOToVO(locationTypeDao.getById(id));
    }

    public List<SiteLocationTypeVO> searchPage(SiteLocationTypeParam params) {
        List<SiteLocationTypeDO> list = locationTypeDao.searchPage(params);
        return SiteLocationTypeConvert.DOToVOList(list);
    }

    public SiteLocationTypeDO select(Long siteLocationTypeId) {
        return locationTypeDao.getById(siteLocationTypeId);
    }
}
